package com.taiji.webfluxcurd.service.impl;

import com.taiji.webfluxcurd.domain.Prize;
import com.taiji.webfluxcurd.domain.PrizeRepository;
import com.taiji.webfluxcurd.service.IPrizeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import reactor.core.publisher.Mono;

import java.util.UUID;

@Service
public class PrizeServiceImpl implements IPrizeService {
    @Autowired
    private PrizeRepository prizePepository;

    @Override
    public Mono<Prize> add(Prize prize) {
        String id = UUID.randomUUID().toString().replaceAll("-", "");
        prize.setId(id);
        prize.setName("事务测试");
        return prizePepository.addPrize(prize);
    }
}
